#!/bin/sh

# Usage:
#    bash <(curl -fL https://gitee.com/fjrti/vimrc/raw/master/install.sh) 
#    vim +PlugInstall
# Requires:
#    vim8 ripgrep ctags global fd python2.7+/3.1+  
#    leaderf : gcc 
# 

set -e

vimplug_file=https://raw.githubusercontent.com/fjrti/vim-plug/master/plug.vim
vimrc_git=https://gitee.com/fjrti/vimrc.git

mkdir -p  ~/.local/vimroot/user/{autoload,tmp,plugins}
curl -fLo ~/.local/vimroot/user/autoload/plug.vim $vimplug_file

git clone --depth=1 $vimrc_git ~/.local/vimroot/user/

cat > ~/.vimrc << EOF
let \$vimroot='~/.local/vimroot'
source ~/.local/vimroot/user/vimrc/init.vim
EOF

echo "Installed the vimrc successfully! Run \"vim +PlugInstall\" to install plugin."
exit 0 
